package urldecode;

import java.io.File;
import java.util.List;


public class UrlDecode {
	public static void main(String[] args) throws Exception {
		Decoder dc = new Decoder();
		File f = new File(args[0]);
		
		if (args.length == 0) {
			System.out.println("缺少参数！");
			System.out.println("用法：");
			System.out.println("用法1: java -jar Decode.jar [加密字符串]");
			System.out.println("用法2: java -jar Decode.jar [加密文件路径]");
			System.out.println("用法3: java -jar Decode.jar [加密文件路径] [解密文件输出路径]");
			System.out.println("用法4: java -jar Decode.jar [加密数组列表]");
		}
		
		if (args.length == 1 && f.exists()) {
			printli(dc.Decode(f));
		}else if (args.length == 1 && !f.exists()){
			printli(dc.Decode(args[0]));
		}else if (args.length == 2 && f.exists()) {
			dc.Decode(args[0], args[1]);
		}
}
	
	static void printli (List<String> list) {
		for (String s : list) {
			System.out.println(s);
		}
	}
}
